#ifndef ABSTRACTWEBVIEW_H
#define ABSTRACTWEBVIEW_H

#include <QWidget>
#include <QUrl>
#include <QVariant>

class AbstractWebView : public QWidget
{
    Q_OBJECT
public:
    explicit AbstractWebView(QWidget *parent = nullptr) : QWidget(parent) {}
    virtual ~AbstractWebView() {}

    virtual void setUrl(const QUrl &url) = 0;
    virtual void evaluateJavaScript(const QString &script, const std::function<void(const QVariant&)>& callback) = 0;
    virtual QString syncJavaScript(const QString &script) = 0;
    virtual void addJavaScriptObject(const QString &name, QObject *obj) = 0;
    virtual void stop() = 0;
    virtual void reload() = 0;

signals:
    void loadFinished(bool ok);
};

#endif // ABSTRACTWEBVIEW_H 
